$(function(){
    $('#TabPage2 li').click(function(){
        var index = $(this).index();
        $(this).find('img').attr('src', '../../img/firmeImage/common/'+ (index+1) +'_hover.jpg');
        $(this).css({background:'#fff'});
        $('#nav_module').find('img').attr('src', '../../img/firmeImage/common/module_'+ (index+1) +'.png');
        $('#TabPage2 li').each(function(i, ele){
            if( i!=index ){
                $(ele).find('img').attr('src', '../../img/firmeImage/common/'+ (i+1) +'.jpg');
                $(ele).css({background:'#044599'});
            }
        });
        // 显示侧边栏
        switchSysBar(true);
    });

    // 显示隐藏侧边栏
    $("#show_hide_btn").click(function() {
        switchSysBar();
    });
});

/**隐藏或者显示侧边栏**/
function switchSysBar(flag){
    var side = $('#side');
    var left_menu_cnt = $('#left_menu_cnt');
    if( flag==true ){	// flag==true
        left_menu_cnt.show(500, 'linear');
        side.css({width:'280px'});
        $('#top_nav').css({width:'77%', left:'304px'});
        $('#main').css({left:'280px'});
    }else{
        if ( left_menu_cnt.is(":visible") ) {
            left_menu_cnt.hide(10, 'linear');
            side.css({width:'60px'});
            $('#top_nav').css({width:'100%', left:'60px', 'padding-left':'28px'});
            $('#main').css({left:'60px'});
            $("#show_hide_btn").find('img').attr('src', '../../img/firmeImage/common/nav_show.png');
        } else {
            left_menu_cnt.show(500, 'linear');
            side.css({width:'280px'});
            $('#top_nav').css({width:'77%', left:'304px', 'padding-left':'0px'});
            $('#main').css({left:'280px'});
            $("#show_hide_btn").find('img').attr('src', '../../img/firmeImage/common/nav_hide.png');
        }
    }
}